package Xipai;

import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        CardGame cardGame = new CardGame();
        List<Card> cardList =  cardGame.generateCard();
        System.out.println(cardList);

        cardGame.shuffle(cardList);
        System.out.println("洗牌" + cardList);


        List<Card> hands1 = new ArrayList<>();
        List<Card> hands2 = new ArrayList<>();
        List<Card> hands3 = new ArrayList<>();//用来存三个人的牌

        List<List<Card>> hands = new ArrayList<>();//把三个人的List联系起来

        hands.add(hands1);
        hands.add(hands2);
        hands.add(hands3);


        //三个人轮流抓牌，每个人抓五张牌
        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 3; j++) {
                Card card = cardList.remove(0);
                hands.get(j).add(card);


            }
        }

        System.out.println("第1个人的牌" + hands.get(0));
        System.out.println("第2个人的牌" + hands.get(1));
        System.out.println("第3个人的牌" + hands.get(2));
        System.out.println("剩下的牌" + cardList);
        System.out.println("剩下" + cardList.size() + "张牌");

    }
}
